<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // es5构造函数继承
        function Person() {
            this.name = '123'
            this.age = 18
        }

        Person.prototype.call = function () {
            console.log("es5")
        }

        function SmartPerson() {
            Person.call(this)
            this.class = '456'
            this.size = "789"
        }

        // es6继承
        class Phone {
            // 构造方法
            constructor() {
                this.brand = 123
                this.price = 123
            }

            call() {
                console.log("es6")
            }
        }

        class SmartPhone2 extends Phone {
            constructor() {
                super();
                this.color = 'color'
                this.size = 24
            }

            photo() {

            }

            playGame() {

            }

            call() {
                console.log("父类的call")
            }
        }

        const xiaomi = new SmartPhone2()
        console.log(xiaomi)
        xiaomi.call()
    </script>
</body>

</html>